<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  medias
 */

class m_medias_documents_Parameter extends m_medias_documents_ParameterBase
{
	/**
	 * @return m_medias_documents_Parameter
	 */
	public static function createNew()
	{
		return new self();
	}
	
	/**
	 * @return m_medias_documents_Parameter
	 */
	public static function getInstanceByUniqueId($id, $lang = null)
	{
		if(is_null($lang)) $lang = f_core_Context::getInstance()->getLang();
		$cache = f_core_Cache::getInstance();
		
		$key = $cache->getDocumentCacheKey($id, $lang);
		
		if($cache->hasCache($key))
		{
			return $cache->getCacheContent($key);
		}
		
		$object = new self($id, $lang);
		
		$cache->putInCache($key, $object);
		
		return $object;
	}
	
	public function getEditUrl()
	{			
		return f_core_Routing::getUrl("mediaParameterEdit", array("folderLang" => strtolower($this->getLang()), "folderId" => $this->getFolderId(), "docId" => $this->getUniqueId()));
	}


    public function getBoSearchDocTypeLabel()
    {
        return f_locale_Manager::getLocale('medias.documents.parameter');
    }
}